from appium.webdriver.common.appiumby import AppiumBy
from base.authorize_base import AuthorizeBase
from appium.webdriver import Remote

class AuthorizePage(AuthorizeBase):
    def privary_agree_button_click(self,driver:Remote):
        privary_agree_button_xpath=self.privary_agree_button()
        return self.click_new(driver,AppiumBy.XPATH,privary_agree_button_xpath)

    def authorize_agree_button_click(self,driver:Remote):
        authorize_agree_button_xpath=self.authorize_agree_button()
        return self.click_new(driver,AppiumBy.XPATH,authorize_agree_button_xpath)

    def ad_close_button_click(self,driver:Remote):
        ad_close_button_xpath=self.ad_close_button()
        return self.click_new(driver,AppiumBy.XPATH,ad_close_button_xpath)

    def authorize_setup(self,driver:Remote):
        self.privary_agree_button_click(driver)
        self.authorize_agree_button_click(driver)
        self.ad_close_button_click(driver)

    def authorize_assert(self, driver, img_name):
        """
          访问首页后判断图书标签
            :param driver:
            :param img_name:
            :return:
            """
        return self.find_img_in_source(driver, img_name)